# 守护进程
import time
from multiprocessing import Process


def task(name):
    print(f'{name}守护进程活着')
    time.sleep(3)
    print(f'{name}守护进程死亡')


if __name__ == '__main__':
    p = Process(target=task, args=('jack',))
    p.daemon = True  # 将进程p设置成守护进程 必须在start()前
    p.start()

    print('主进程结束')
